<?php
$lang = strtolower($_GET["language"]); 
$wordlist = $_GET["wordlist"];

$filename = $lang . "/" . $wordlist . ".xml";

if ( file_exists( $filename ) ) {

	$xml_contents=file_get_contents($filename); 
	$xml_parse=xml_parser_create(); 
	xml_parser_set_option($xml_parse, XML_OPTION_CASE_FOLDING,0); 
	xml_parser_set_option($xml_parse, XML_OPTION_SKIP_WHITE,1); 
	xml_parse_into_struct($xml_parse, $xml_contents, $values); 
	xml_parser_free($xml_parse);
	
	foreach($values as $value) {
		if($value['tag']=='english') 
			$english = $value['value']; 
		if($value['tag']=='other') 
			$other = $value['value'];
		if($value['tag']=='hint')
			$hint = $value['value'];
		if ( $other != '' && $english != '' && $hint != '' ) {
			echo $english . "," . $other . "," . $hint . ";";
			$english = '';
			$other = '';
			$hint = '';
		}
	}
} else {
	echo "File, $filename, does not exist";
}
?>